from src.config import settings
from src.server import Orin
from .process_id import get_id_list


class StopPs(object):
    def get_id_list(self, ip, type):
        with Orin(ip=ip, username=settings.username, password=settings.password, type=type) as orin:

            return get_id_list(orin, type)

    def kill_orin(self, ip, ps_list):
        with Orin(ip=ip, username=settings.username, password=settings.password) as orin:
            for i in ps_list:
                orin.exec_command("sudo kill -9 {0}".format(i))
